#### ReadMe for the replication files for "Partisan disparities in the funding of science in the United States"
#### 9/03/2025
#### Furnas, Fishman, Rosensteil, Wang

The scripts contained were run on an Apple MacBook Pro with an Apple 3M Max chip and 96GB of RAM running in Sequoia 15.3 MacOS. The scripts were run in R version 4.4.1 (2024-06-14). They load the following packages:

        Package   Version
       cowplot     1.1.3
  directlabels 2025.5.20
  equatiomatic     0.3.3
        fixest    0.12.1
          here     1.0.1
        jtools     2.3.0
          MASS  7.3-60.2
  modelsummary     2.2.0
     tidyverse     2.0.0
    treemapify     2.5.6
     lubridate     1.9.3
        xtable     1.8-4
          here     1.0.1
     Hotelling     1.0-8
  interactions     1.2.0
     tidyverse     2.0.0


The replication files consist of 4 .R scripts and associated data files. These are described below

AnalysisScript1.R -- Script for majority of the analysis contained in the main text and the supplement. It contains all of the analysis code for looking at appropriations data.

AnalysisScript2.R -- Script for generating Fig S2A, which plots the amount of federal disbursments via awards and contracts. Loads "science_accounts_crosswalk.csv", "usa_spending_science_contracts_fy2019.csv", and "usa_spending_science_assistance_fy2019.csv"

AnalysisScript3.R -- Script for analyzing how federal grants are allocated across fields. Generates main text Fig 5 and SM Fig S5B and Fig S5C. Loads "us_funding_by_funder_by_year.csv" and "us_funding_by_funder_by_year_high_level_for_field.csv". 

load_data.R -- a data loader script called by AnalysisScript1.R which loads and reshapes the appropriations data. Calls USA_Gov_Funder_List.csv

permutations.R -- a helper script which conducts permutation tests as part of the generation of Fig. 4.


us_funding_by_funder_by_year.csv -- funding amounts (grants) for each government funder by year. 
science_toplines.xlsx -- topline budget numbers used in AnalysisScript1.R as a covariate in many models
science_covariates.xlsx -- control variables for appropriatios models.
usa_spending_science_contracts_fy2019.csv -- FY2019 contracts data from USASpending.gov
usa_spending_science_assistance_fy2019.csv -- FY2019 awards data from USASpending.gov
science_accounts_crosswalk.csv -- crosswalk linking science and research approrpriations accounts to spending accounts from USASpending.gov data.
science_appropriations.csv -- yearly presidential budget requests, house marks, senate marks and appropriations for each acount analyzed
USA_Gov_Funder_List.csv -- Federal grantmaking program list with departments.
science_crosswalk.xlsx -- list of science and research accounts with indicators for department and strict inclusion.
us_funding_by_funder_by_year_high_level_for_field.csv -- funding amounts (grants) for each government funder to papers in each field of research by year. 



